package exceptions;

import app.Token;

/**
 *
 * @author Julio
 */
public class SintaticoException extends Exception{
    
    private int type;
    private int line;
    
    private String message;
    
    private Token current;
    
    public static final int EXPECTED_TOKEN = 0;


    public SintaticoException(Token current, int line){
        this.type = EXPECTED_TOKEN;
        this.line = line;
        this.current = current;
    }
    
    public SintaticoException(int type){
        this.type = type;
    }
    
    @Override
    public void printStackTrace(){
        switch(type){           
                
            case EXPECTED_TOKEN:
                
                message = "[ERRO]Erro na linha %d.\nArgumento: \"%s\" nao esperado.";
                message = String.format(message, line, current.getSimbol());
                System.err.println(message);            
                
                break;
        }
    }

}
